/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;
  router.get('/', controller.home.index);
  router.get('/test', controller.home.test);
    // 用户相关路由
  router.post('/api/users/login', controller.users.login);
  router.get('/api/users/info', controller.users.getUserInfo);
  router.put('/api/users/info', controller.users.updateUserInfo);
  router.post('/api/users/logout', controller.users.logout);
  router.post('/api/users/setCozeAccessToken',controller.users.setCozeAccessToken);//setCozeAccessToken
  router.post('/api/users/setCozeOAuth',controller.users.setCozeOAuth);
  router.get('/api/users/sonsUsers', controller.users.getMySonsUsers); //获取我的下级用户
  // Coze相关路由
  // router.get('/api/coze/cached-token', controller.coze.getCachedAccessToken); //带缓存的获取AT
  router.get('/api/coze/bots', controller.coze.getBotsList); // 获取智能体列表
  router.get('/api/coze/workspaces', controller.coze.getWorkspaceList); // 获取空间列表
  router.get('/api/coze/botInfo', controller.coze.getBotInfo);// 获取智能体信息
  router.get('/api/coze/allSpaceAndBot', controller.coze.getAllSpaceAndBot);// 获取空间和智能体列表
  router.post('/api/coze/createConversation', controller.coze.createConversation);// 创建会话
  router.post('/api/coze/myLastConversation', controller.coze.getMyLastConversation);// 获取我的最新会话
  router.get('/api/coze/conversation', controller.coze.getConversationById);


  //智能体相关路由
  router.post('/api/agent/publicAgent',controller.agent.publicAgent);// 创建公开智能体
  router.get('/api/agent/myAgentList',controller.agent.getMyAgentList);// 获取我的智能体列表
  router.get('/api/agent/publicAgentList',controller.agent.getAllPublicAgentList);// 获取公开智能体列表
  // setAgentIsPublic 设置智能体是否公开 POST
  router.post('/api/agent/setAgentIsPublic',controller.agent.setAgentIsPublic);
  // syncAgentInfo 同步智能体信息 GET
  router.get('/api/agent/syncAgentInfo',controller.agent.syncAgentInfo);
  // getAgentInfoByAgentId 根据智能体ID获取智能体信息 GET
  router.get('/api/agent/getAgentInfoByAgentId',controller.agent.getAgentInfoByAgentId);

  //对话
  router.post('/api/chat/createAndChat',controller.coze.chat.createMessageAndChat);// 创建消息并对话
  router.get('/api/chat/detail',controller.coze.chat.getChatDetailById);// 获取对话详情
  router.get('/api/chat/message',controller.coze.chat.getChatMessageById);// 获取对话消息
  //deleteMessage 删除单条消息 GET
  router.get('/api/message/deleteMessage',controller.coze.chat.deleteMessage);
  // 创建单条消息 POST
  router.post('/api/message/createMessage',controller.coze.chat.createMessage);// 创建对话
  // clearConversation 清空会话 GET
  router.get('/api/conversation/clearConversation',controller.coze.chat.clearConversation);
  // getAllHistoryMessage 获取全部历史消息 GET
  router.get('/api/message/getAllHistoryMessage',controller.coze.chat.getAllHistoryMessage);

  /**
   * 微信支付接口
   */
  router.post('/api/vip/pay',controller.vip.pay); // 开通会员 - 微信支付
  router.post('/api/vip/notify',controller.vip.notify); // 微信支付回调
  router.post('/api/vip/payCheck',controller.vip.payCheck); // 检查支付校验接口

  /**
   * 邀请码相关
   */
  router.post('/api/inviteCode/use',controller.inviteCode.use); // 使用邀请码
  router.get('/api/inviteCode/generate',controller.inviteCode.generate); // 生成邀请码
  router.get('/api/inviteCode/list',controller.inviteCode.list); // 获取邀请码列表

  /**
   * 对外接口
   */

  //getCacheMessage
  router.get('/api/message/getCacheMessage',controller.coze.chat.getCacheMessage);


  //stopChat
  router.get('/api/chat/stopChat',controller.coze.chat.stopChat);
  //getUserAskLog
  router.get('/api/chat/getUserAskLog',controller.coze.chat.getUserAskLog);


};
